import { getShopsListApi } from "@/api/modules/merchant";
import { getProductCategoryList } from "@/api/modules/product";
import { ShopStatus } from "@/enums";

export const SEARCH_COLUMNS = [
	{
		type: "input",
		placeholder: "商品关键词",
		name: "product_name"
		// fieldProps: {
		// 	prefix: '商品关键词'
		// }
	},
	// {
	// 	type: "digital",
	// 	placeholder: "商品ID",
	// 	name: "product_id"
	// },
	{
		type: "select",
		placeholder: "商品分类",
		name: "category_id",
		fieldProps: {
			fieldNames: {
				label: "category_name",
				value: "category_id"
			}
		},
		request: async () => {
			const res = await getProductCategoryList();
			return res?.data ?? [];
		}
	},
	{
		type: "select",
		placeholder: "店铺名称",
		name: "shop_name",
		fieldProps: {
			fieldNames: {
				label: "shop_name",
				value: "shop_id"
			},
			labelInValue: true
		},
		request: async () => {
			const res = await getShopsListApi({ keyword: "", shop_status: ShopStatus.OPEN });
			return res?.data ?? [];
		}
	}
];

export const PRODUCT_STATUS_VALUES = {
	//已上架
	sales: 1,
	//待上架
	sale_pending: 0,
	// 已下架
	off_shelf: -1
};

export const PRODUCT_STATUS_OPTIONS = [
	{
		label: "已上架",
		value: PRODUCT_STATUS_VALUES.sales
	},
	{
		label: "待上架",
		value: PRODUCT_STATUS_VALUES.sale_pending
	},
	{
		label: "已下架",
		value: PRODUCT_STATUS_VALUES.off_shelf
	}
];

export const TAB_VALUES = {
	//全部
	all: ""
};

export const TABS = [
	{
		label: "全部",
		key: TAB_VALUES.all
	},
	{
		label: "已上架",
		key: PRODUCT_STATUS_VALUES.sales
	},
	{
		label: "待上架",
		key: PRODUCT_STATUS_VALUES.sale_pending
	},
	{
		label: "已下架",
		key: PRODUCT_STATUS_VALUES.off_shelf
	}
];
